package com.example.gulimall.order.config;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.PostConstruct;

/**
 * <p>
 *
 * </p>
 *
 * @author zyred
 * @since v 0.1
 **/
@Slf4j
@Configuration
@AllArgsConstructor
public class OrderWebConfig implements WebMvcConfigurer {

    LoginUserInterceptor loginUserInterceptor;
    // @Autowired private final SeataHandlerInterceptor requestInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.loginUserInterceptor);
        // registry.addInterceptor(this.requestInterceptor);
    }

    @PostConstruct
    public void init () {
        log.info("order 项目 执行了 OrderWebConfig 初始化!");
        log.info("登录拦截器：{} " , loginUserInterceptor);
    }
}
